package main

import (
	"fmt"
	"strconv"
)

func main() {
	defer func() {
		if r := recover(); r != nil {
			fmt.Printf("Recovered from panic: %v\n", r)
		}
	}()
	causePanic()
	fmt.Println("This line will be printed after recovery.")
}

func causePanic() {
	panic("Something went wrong!")
	// panic: Something went wrong
	// main.causePanic(...)
}

func errorCheck() {
	input := "abc"
	// 输入验证
	num, err := strconv.Atoi(input)
	if err != nil {
		fmt.Printf("Invalid input: %v\n", err)
		return
	}
	// 处理合法输入
	fmt.Println(num)
}
